import { request } from '@utils/http'
import {
  IprovinceList,
  IhospitalParams,
  IhospitalListRes,
  IhospitalShow,
} from './model/hospitalListTypes'
// 获取省数据的函数
export function reqGetProvince(dictCode = 'province') {
  return request.get<any, IprovinceList>(
    `/admin/cmn/dict/findByDictCode/${dictCode}`
  )
}

// 获取市数据的函数
export function reqGetCityOrDistrict(parentId: string) {
  return request.get<any, IprovinceList>(
    `/admin/cmn/dict/findByParentId/${parentId}`
  )
}

// 获取医院列表数据的函数
export function reqGetHospitalList({
  page,
  limit,
  hosname,
  hoscode,
  hostype,
  provinceCode,
  cityCode,
  districtCode,
  status,
}: IhospitalParams) {
  return request.get<any, IhospitalListRes>(
    `/admin/hosp/hospital/${page}/${limit}`,
    {
      params: {
        hosname,
        hoscode,
        hostype,
        provinceCode,
        cityCode,
        districtCode,
        status,
      },
    }
  )
}

// 获取医院详情的函数
export function reqGetHospitalShow(id: string) {
  return request.get<any, IhospitalShow>(`/admin/hosp/hospital/show/${id}`)
}
